package com.zaofan.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.zaofan.bean.Lable;
import com.zaofan.dao.LableDao;

public class LableService {

	private LableDao lableDao = new LableDao();

	public void delete(Lable lable) {
		lableDao.del(lable);
	}

	public void add(Lable lable) {
		lableDao.add(lable);
	}

	public void update(Lable lable) {
		lableDao.update(lable);
	}

	public List<Lable> findAll(Map<String, Object> params) {
		List<Lable> data = lableDao.findAll(params);
		if (data == null) {
			data = new ArrayList<>();
		}
		return data;
	}

	public Long count(Map<String, Object> params) {
		return lableDao.count(params);
	}

	public Lable findById(Integer id) {
		Map<String, Object> params = new HashMap<>();
		params.put("id", id);
		return lableDao.findOne(params);
	}

	public List<Lable> findByType(String type) {
		Map<String, Object> params = new HashMap<>();
		params.put("type", type);
		return lableDao.findAll(params);
	}

}
